package com.xiaomei.manager.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.xiaomei.manager.dao.AllowanceTicketMapper;
import com.xiaomei.manager.model.AllowanceTicket;
import com.xiaomei.manager.service.IAllowanceTicketService;
import com.xiaomei.manager.web.page.Page;

@Service
public class AllowanceTicketServiceImpl implements IAllowanceTicketService {

	@Autowired
	private AllowanceTicketMapper allowanceTicketMapper;
	
	@Override
	public List<AllowanceTicket> selectByParamsForPage(
			Page<AllowanceTicket> page) {
		// TODO Auto-generated method stub
		return allowanceTicketMapper.selectByParamsForPage(page);
	}

	@Override
	public boolean createAllowanceTicket(AllowanceTicket ticket) {
		// TODO Auto-generated method stub
		return allowanceTicketMapper.insertSelective(ticket) == 1 ? true : false;
	}

	@Override
	public AllowanceTicket findOne(Integer id) {
		// TODO Auto-generated method stub
		Object ticket = allowanceTicketMapper.selectByPrimaryKey(id);
		
		return ticket == null ? null : (AllowanceTicket)ticket;
	}

	@Override
	public boolean updateAllowanceTicket(AllowanceTicket ticket) {
		// TODO Auto-generated method stub
		return allowanceTicketMapper.updateByVersionSelective(ticket) == 1 ? true : false;
	}

	@Override
	public boolean deleteAllowanceTicket(Integer id) {
		// TODO Auto-generated method stub
		return allowanceTicketMapper.deleteByPrimaryKey(id) == 1 ? true : false;
	}

}
